﻿/* Check if user name exist */
function CreateShortUrl() {
      $.ajax({
          type: "POST",
          url: "/Parts/Shorten.asmx/CreateShortUrl",
          data: '{LongUrl: "' + $("#LongUrl")[0].value + '", CustomName: "' + $("#CustomName")[0].value + '"}',
          contentType: "application/json; charset=utf-8",
          dataType: "json",
          success: OnSuccess,
          failure: OnFailure,
        
     });

    function OnSuccess(response) {
       var mesg = $(".status")[0];
       mesg.innerHTML = response["d"];
        
      }
                    
    function OnFailure(response) {
        var mesg = $(".status")[0];
        mesg.innerHTML = response["d"];
       }

}
/* END */